package com.ruoyi.ring.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.ring.mapper.RingDeviceMapper;
import com.ruoyi.ring.domain.RingDevice;
import com.ruoyi.ring.service.IRingDeviceService;

/**
 * 设备Service业务层处理
 * 
 * @author liuwp
 * @date 2025-08-18
 */
@Service
public class RingDeviceServiceImpl implements IRingDeviceService 
{
    @Autowired
    private RingDeviceMapper ringDeviceMapper;

    /**
     * 查询设备
     * 
     * @param id 设备主键
     * @return 设备
     */
    @Override
    public RingDevice selectRingDeviceById(Long id)
    {
        return ringDeviceMapper.selectRingDeviceById(id);
    }

    /**
     * 查询设备列表
     * 
     * @param ringDevice 设备
     * @return 设备
     */
    @Override
    public List<RingDevice> selectRingDeviceList(RingDevice ringDevice)
    {
        return ringDeviceMapper.selectRingDeviceList(ringDevice);
    }

    /**
     * 根据业务主键查询一条记录：设备
     *
     * @param ringDevice 设备
     * @return 设备
     */
    @Override
    public RingDevice selectOneRingDevice(RingDevice ringDevice)
    {
        return ringDeviceMapper.selectOneRingDevice(ringDevice);
    }

    /**
     * 新增设备
     * 
     * @param ringDevice 设备
     * @return 结果
     */
    @Override
    public int insertRingDevice(RingDevice ringDevice)
    {
        ringDevice.setCreateTime(DateUtils.getNowDate());
        return ringDeviceMapper.insertRingDevice(ringDevice);
    }

    /**
     * 修改设备
     * 
     * @param ringDevice 设备
     * @return 结果
     */
    @Override
    public int updateRingDevice(RingDevice ringDevice)
    {
        ringDevice.setUpdateTime(DateUtils.getNowDate());
        return ringDeviceMapper.updateRingDevice(ringDevice);
    }

    @Override
    public int updateRingDeviceCondition(RingDevice ringDevice, RingDevice ringDeviceCondition)
    {
                ringDevice.setUpdateTime(DateUtils.getNowDate());
        return ringDeviceMapper.updateRingDeviceCondition(ringDevice, ringDeviceCondition);
    }

    /**
     * 批量删除设备
     * 
     * @param ids 需要删除的设备主键
     * @return 结果
     */
    @Override
    public int deleteRingDeviceByIds(Long[] ids)
    {
        return ringDeviceMapper.deleteRingDeviceByIds(ids);
    }

    /**
     * 删除设备信息
     * 
     * @param id 设备主键
     * @return 结果
     */
    @Override
    public int deleteRingDeviceById(Long id)
    {
        return ringDeviceMapper.deleteRingDeviceById(id);
    }

    /**
     * 条件删除设备
     *
     * @param ringDevice 设备
     * @return 结果
     */
    @Override
    public int deleteRingDeviceByCondition(RingDevice ringDevice)
    {
        return ringDeviceMapper.deleteRingDeviceByCondition(ringDevice);
    }

}
